package com.mock.mybat.mapper;

import com.mock.mybat.entity.Student;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface StudentMapper {
    @Insert("insert into student ( name, sex, age)\n" +
            "values (#{name},#{sex},#{age})")
    void save(Student student);


    @Update("update student set \n" +
            "  name=#{name},\n" +
            "  sex =#{sex},\n" +
            "  age=#{age}\n" +
            "where id =#{id};")
    void update(Student student);

    @Delete("delete from student where id = #{id}")
    void deleteById(@Param("id") Long id);

    @Select("select * from student where id =#{id}")
    Student findbyId(@Param("id") Long id);

    @Select("select * from student limit #{num}")
    List<Student> findSeveral(@Param("num") Integer number);



}
